package com.enation.app.javashop.core.client.fallback.payment;

import com.enation.app.javashop.core.client.feignimpl.payment.WechatSmallchangeClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component;

/**
 * 微信红包断路器 factory
 * @author kingapex
 * @version 1.0
 * @data 2022/5/28 14:59
 **/
@Component
public class WechatSmallchangeClientFallbackFactory extends BaseFallbackFactory<WechatSmallchangeClientFeignImpl> {
    @Override
    protected WechatSmallchangeClientFeignImpl fallback() {
        return new WechatSmallchangeClientFallback();
    }

    /**
     * @author fk
     * @version v2.0
     * @Description: 微信红包断路器
     * @date 2018/9/27 14:40
     * @since v7.0.0
     */
    @Component
    public static class WechatSmallchangeClientFallback implements WechatSmallchangeClientFeignImpl {

        protected final Log logger = LogFactory.getLog(this.getClass());


        @Override
        public boolean autoSend(String openId, Double price, String ip, String sn) {

            logger.error("自动发送红包出错");
            return false;
        }
    }
}
